home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Computers
/
Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso
/
commercial
/
visual_inspirations
/
mlm
/
rexx
/
ppagemailmerge.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1994-11-17
|
4KB
|
162 lines
/*
PPageMailMerge.Rexx
Written By J.L. White
(C) 1993 Merlin's Software
For Use With Mailing List Manager & Professional Page
Use Mail Merge From Database
*/
CR = '0a'x
arg CurrentFile Total
call SetUp
if CurrentFile == 1 then do
call ppm_PPageToFront()
call PickPrint
call ppm_PPageToBack()
end
else call CheckSettings
call GetData
call MergeData
call PrintIt
call ppm_PPageToBack()
if CurrentFile = Total then address command "Delete >NIL: RAM:Info.Temp"
exit
SetUp:
FileName = "RAM:MLM.Temp"
MergePage = "MLM:Rexx/MailMerge.PPage"
ppm_LoadDocument(MergePage,1,0)
return
GetData:
call open MergeData,"RAM:MLM.Temp",'R'
Address1 = strip(readln(MergeData))
Address2 = strip(readln(MergeData))
Address3 = strip(readln(MergeData))
Address4 = strip(readln(MergeData))
LabelA = strip(readln(MergeData))
LabelB = strip(readln(MergeData))
LabelC = strip(readln(MergeData))
LabelD = strip(readln(MergeData))
LabelE = strip(readln(MergeData))
LabelF = strip(readln(MergeData))
LabelG = strip(readln(MergeData))
LabelH = strip(readln(MergeData))
LabelI = strip(readln(MergeData))
LabelJ = strip(readln(MergeData))
call close MergeData
return
MergeData:
ppm_SetEdit("MergeBox")
ppm_Replace("<A>",LabelA,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<B>",LabelB,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<C>",LabelC,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<D>",LabelD,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<E>",LabelE,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<F>",LabelF,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<G>",LabelG,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<H>",LabelH,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<I>",LabelI,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<J>",LabelJ,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<1>",Address1,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<2>",Address2,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<3>",Address3,0,1,1,0)
ppm_SetEdit("MergeBox")
ppm_Replace("<4>",Address4,0,1,1,0)
call ppm_EndEdit()
return
PickPrint:
TypePrint=ppm_Inform(2,"Postscript Or Preference Printer","PREFERENCE PRINTER","POSTSCRIPT")
if TypePrint = 1 then call PostPrint
if TypePrint = 0 then call PrefPrint
call open InfoData,"RAM:Info.Temp",'W'
call writeln InfoData,TypePrint
call writeln InfoData,TypeOutPut
call writeln InfoData,Manual
call writeln InfoData,NumCopy
call writeln InfoData,Eject
call writeln InfoData,Density
call close InfoData
return
PostPrint:
OutPut = ppm_Inform(3,"Select Type Of Output To Use?","DISK","SER:","PAR:");
if OutPut = 2 then TypeOutPut = "PAR:"
if OutPut = 1 then TypeOutPut = "SER:"
if OutPut = 0 then do
TypeOutPut = ppm_GetUserText(50,"Enter Name For Output File!")
if TypeOutPut = "" then call NoPrint
TypeOutPut = TypeOutPut
end
call ppm_SetPSOutput(TypeOutPut)
Manual = ppm_Inform(2,"Manual Feed ON-OFF?","OFF","ON")
call ppm_SetPSManFeed(Manual)
NumCopy = ppm_GetUserText(3,"Enter # Of Copies To Print!")
if NumCopy < 1 then call NoPrint
return
PrefPrint:
Eject=ppm_Inform(2,"Eject Page ON-OFF?","OFF","ON")
call ppm_SetDMEject(Eject)
Text = "4"cr"1"cr"2"cr"3"cr"5"cr"6"cr"7"
Density = value(ppm_SelectFromList(" Select Density",1,7,0,Text))
if Density < 1 then call NoPrint
call ppm_SetDMDensity(Density)
NumCopy = ppm_GetUserText(3,"Enter # Of Copies To Print!")
if NumCopy < 1 then call NoPrint
return
NoPrint:
ppm_Inform(1,"Printing Has Been Cancelled!","OK")
call ppm_PPageToBack()
address command "Delete >NIL: RAM:Info.Temp"
call ppm_New()
exit
return
CheckSettings:
call open InfoData,"RAM:Info.Temp",'R'
TypePrint = readln(InfoData)
TypeOutPut = readln(InfoData)"."CurrentFile
Manual = readln(InfoData)
NumCopy = readln(InfoData)
Eject = readln(InfoData)
Density = readln(InfoData)
call close InfoData
if TypePrint = 1 then do
call ppm_SetPSOutput(TypeOutPut)
call ppm_SetPSManFeed(Manual)
end
if TypePrint = 0 then do
call ppm_SetDMEject(Eject)
call ppm_SetDMDensity(Density)
end
return
PrintIt:
if TypePrint = 1 then call ppm_PrintDocPS(NumCopy,1)
if TypePrint = 0 then call ppm_PrintDocDM(NumCopy,1)
return